sudo chmod +x /etc/rc.local

Warning: raspberrypi:0 is taken because of /tmp/.X0-lock
Remove this file if there is no X server raspberrypi:0
A VNC server is already running as :0



Step 1: add startx to /etc/rc.local
The easiest cheat to start an application after the linux boot process, is to modify /etc/rc.local. This file is executed as the last step in the init process and you can use it to put all kinds of geeky stuff in there. If you're looking for something more advanced then you can create a script and add it to /etc/init.d, but let's keep things simple. The rc.local file is more than enough for day-to-day needs.

Of course, we'll be wanting to launch the X server. Hence we'll add the startx command to /etc/rc.local.
#~your_user/.xinitrc
/usr/bin/gambas3


Code: Select all
    #/etc/rc.local
    su -s /bin/bash -c startx your_user&

As a step-by-step clarification, this will:
- impersonate a user of your choice (here it is your_user)
- start a shell of your choice (here it is /bin/bash)
- and launch startx within that shell

Step 2: allow non-interactive processes to launch an X server
Your linux distro is likely to come configured so that only root or interactive sessions (consoles or shells) can launch the X server. Non-interactive processes, such as the boot process, are typically prohibited from doing so. Seeing as you want everything to launch automatically at boot, you will need a way around this, or your X session will refuse to start at boot and all you'll see is a bunch of "permission denied" messages on your console instead.